/*
  File: BaseEntity.cs
  Author: rcrxy
  CreateTime: 2025/06/26 18:37

  Description:
*/

using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using NUlid;

namespace StudentVideo.Data.Entities;

/// <summary>
/// 基础字段
/// </summary>
public abstract class BaseEntity {
   /// <summary>
   /// 唯一id
   /// </summary>
   [Key]
   [MaxLength(50)]
   [Column(TypeName = "varchar(50)", Order = 1)]
   public virtual string Id { get; set; } = Ulid.NewUlid().ToString();

   /// <summary>
   /// 上次修改人
   /// </summary>
   [MaxLength(50)]
   [Column(Order = 97)]
   public virtual string? UpdateBy { get; set; }

   /// <summary>
   /// 创建人
   /// </summary>
   [MaxLength(50)]
   [Column(Order = 98)]
   public virtual string? CreateBy { get; set; }

   /// <summary>
   /// 上次更新时间
   /// </summary>
   [Column(Order = 99)]
   public virtual DateTime UpdateAt { get; set; } = DateTime.Now;

   /// <summary>
   /// 创建时间
   /// </summary>
   [Column(Order = 100)]
   public virtual DateTime CreateAt { get; set; } = DateTime.Now;
}
